package com.aaa.service.yy.impl;

import com.aaa.dao.yy.QuSdsDao;
import com.aaa.pojo.yy.QuSds;
import com.aaa.service.yy.QuSdsService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class QuSdsServiceImpl implements QuSdsService {
    @Autowired
    private QuSdsDao quSdsDao;



    @Override
    public List<QuSds> findAll(String page, String limit) {
         int pageInt = Integer.parseInt(page);
         int limitInt = Integer.parseInt(limit);
         int start = (pageInt - 1)*limitInt;
        List<QuSds> all = quSdsDao.findAll(start, limitInt);
        return all;
    }


    @Override
    public int findCount() {
        int count = quSdsDao.findCount();
        return count;
    }

    @Override
    public int insert(QuSds quSds) {
        int insert = quSdsDao.insert(quSds);
        return insert;
    }

    @Override
    public int update(QuSds quSds) {
        int update = quSdsDao.update(quSds);
        return update;
    }

    @Override
    public int delete(@Param("idList") List idList) {
        int delete = quSdsDao.delete(idList);
        return delete;
    }

    @Override
    public List<QuSds> fuzzyQuestionAndCreatBy(String question, String createBy,String page ,String limit) {
        int pageInt = Integer.parseInt(page);
        int limitInt = Integer.parseInt(limit);
        int start = (pageInt - 1)*limitInt;
        List<QuSds> quSds = quSdsDao.fuzzyQuestionAndCreatBy(question, createBy,start,limitInt);
        return quSds;
    }

    @Override
    public List<QuSds> findAllQuestion() {
        List<QuSds> allQuestion = quSdsDao.findAllQuestion();
        return allQuestion;
    }


}


